# ******************************************************************************************
# 版权所有 2021-2021, Turix实验中心。保留所有权利。
# 文件名：Makefile
# 作者：燕卫博    版本：V1.1    修改日期：2021.8.13
# ******************************************************************************************
VERSION = 1.1

CHIP = HI3516DV300
CC = arm-himix200-linux-gcc
DEST = lp_9Hv2
# ------------------------------------------------------------
# SDK_VERSION为工程使用的SDK版本，需要保证程序使用的lib和板端
# 挂载的ko的版本是一致的。
# ------------------------------------------------------------
SDK_VERSION = V2.0.2.0
# ------------------------------------------------------------
# SENSOR_TYPE为工程使用的传感器型号，当前支持IMX307或GC2053
# ------------------------------------------------------------
SENSOR_TYPE = GC2053

OBJS = main.o L_RTP.o L_SVP_NNIE_model.o L_SVP_IVE_csc.o 

CFLAGS  = -Wall -std=gnu99 -g 
LDFLAGS = -lpthread -ldl -lm

ifeq ($(CHIP), HI3516DV300)
OBJS += ./L_MPP40_3516DV300/L_MPP40_sys.o \
        ./L_MPP40_3516DV300/L_MPP40_vi.o \
        ./L_MPP40_3516DV300/L_MPP40_vpss.o \
        ./L_MPP40_3516DV300/L_MPP40_venc.o \
        ./L_MPP40_3516DV300/L_MPP40_vo.o \
        ./L_MPP40_3516DV300/L_MPP40_vgs.o

    ifeq ($(SDK_VERSION), V2.0.1.1)
    LIBS += ./lib_3516DV300_V2.0.1.1/libmpi.a \
            ./lib_3516DV300_V2.0.1.1/libhdmi.a \
            ./lib_3516DV300_V2.0.1.1/libnnie.a \
            ./lib_3516DV300_V2.0.1.1/libsecurec.a \
            ./lib_3516DV300_V2.0.1.1/libVoiceEngine.a \
            ./lib_3516DV300_V2.0.1.1/libupvqe.a \
            ./lib_3516DV300_V2.0.1.1/libdnvqe.a \
            ./lib_3516DV300_V2.0.1.1/libisp.a \
            ./lib_3516DV300_V2.0.1.1/lib_hidrc.a \
            ./lib_3516DV300_V2.0.1.1/lib_hildci.a \
            ./lib_3516DV300_V2.0.1.1/lib_hidehaze.a \
            ./lib_3516DV300_V2.0.1.1/lib_hiae.a \
            ./lib_3516DV300_V2.0.1.1/lib_hiawb.a \
            ./lib_3516DV300_V2.0.1.1/libive.a 

    CFLAGS += -I./include_3516DV300_V2.0.1.1 -I./L_MPP40_3516DV300 

    ifeq ($(SENSOR_TYPE), IMX307)
    LIBS   += ./lib_3516DV300_V2.0.1.1/libsns_imx307_2l.a
    CFLAGS += -DSENSOR_IMX307
    endif

    ifeq ($(SENSOR_TYPE), GC2053)
    LIBS   += ./lib_3516DV300_V2.0.1.1/libsns_gc2053.a
    CFLAGS += -DSENSOR_GC2053
    endif

    endif

    ifeq ($(SDK_VERSION), V2.0.2.0)
    LIBS += ./lib_3516DV300_V2.0.2.0/libmpi.a \
            ./lib_3516DV300_V2.0.2.0/libhdmi.a \
            ./lib_3516DV300_V2.0.2.0/libnnie.a \
            ./lib_3516DV300_V2.0.2.0/libsecurec.a \
            ./lib_3516DV300_V2.0.2.0/libVoiceEngine.a \
            ./lib_3516DV300_V2.0.2.0/libupvqe.a \
            ./lib_3516DV300_V2.0.2.0/libdnvqe.a \
            ./lib_3516DV300_V2.0.2.0/libisp.a \
            ./lib_3516DV300_V2.0.2.0/lib_hidrc.a \
            ./lib_3516DV300_V2.0.2.0/lib_hildci.a \
            ./lib_3516DV300_V2.0.2.0/lib_hidehaze.a \
            ./lib_3516DV300_V2.0.2.0/lib_hiae.a \
            ./lib_3516DV300_V2.0.2.0/lib_hiawb.a \
            ./lib_3516DV300_V2.0.2.0/libive.a \
            ./lib_3516DV300_V2.0.2.0/lib_hicalcflicker.a

    CFLAGS += -I./include_3516DV300_V2.0.2.0 -I./L_MPP40_3516DV300 

    ifeq ($(SENSOR_TYPE), IMX307)
    LIBS   += ./lib_3516DV300_V2.0.2.0/libsns_imx307_2l.a
    CFLAGS += -DSENSOR_IMX307
    endif

    ifeq ($(SENSOR_TYPE), GC2053)
    LIBS   += ./lib_3516DV300_V2.0.2.0/libsns_gc2053.a
    CFLAGS += -DSENSOR_GC2053
    endif

    endif

endif

all:lprogram

lprogram:$(OBJS)
	@$(CC) $(LDFLAGS) -o $(DEST) $(OBJS) $(LIBS) 

$(OBJS):%.o:%.c
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	rm -f *.o
	rm -f ./L_MPP40_3516DV300/*.o
	rm -f $(DEST)

clear:
	rm -f *.o
	rm -f ./L_MPP40_3516DV300/*.o
